From: iap10@labyrinth.cl.cam.ac.uk Date: Sun, 2 May 2004 00:52:45 +0000 (+0000) Subject: bitkeeper revision 1.885 (4094465dmX2TefiJicy4taNzc0jiaw) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~18236 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=3882a78594317ddcaeb97e585080a998ab8a17fe;p=xen.git bitkeeper revision 1.885 (4094465dmX2TefiJicy4taNzc0jiaw) manual merge --- 3882a78594317ddcaeb97e585080a998ab8a17fe diff --cc tools/xc/lib/xc_linux_build.c index 42696666a8,27bc6c6668..67351210fc --- a/tools/xc/lib/xc_linux_build.c +++ b/tools/xc/lib/xc_linux_build.c @@@ -71,10 -70,11 +71,11 @@@ static int setup_guestos(int xc_handle gzFile initrd_gfd, unsigned long initrd_len, unsigned long nr_pages, unsigned long *pvsi, unsigned long *pvke, - dom0_builddomain_t *builddomain, + full_execution_context_t *ctxt, const char *cmdline, unsigned long shared_info_frame, - unsigned int control_evtchn) + unsigned int control_evtchn, + int io_priv) { l1_pgentry_t *vl1tab=NULL, *vl1e=NULL; l2_pgentry_t *vl2tab=NULL, *vl2e=NULL; @@@ -444,9 -440,9 +446,9 @@@ int xc_linux_build(int xc_handle if ( setup_guestos(xc_handle, domid, image, image_size, initrd_gfd, initrd_size, nr_pages, &vstartinfo_start, &vkern_entry, - &launch_op.u.builddomain, cmdline, + ctxt, cmdline, op.u.getdomaininfo.shared_info_frame, - control_evtchn) < 0 ) + control_evtchn, io_priv) < 0 ) { ERROR("Error constructing guest OS"); goto error_out; diff --cc tools/xc/lib/xc_netbsd_build.c index 7c67d57d71,cac444bd80..8260c75ea4 --- a/tools/xc/lib/xc_netbsd_build.c +++ b/tools/xc/lib/xc_netbsd_build.c @@@ -60,10 -59,11 +60,11 @@@ static int setup_guestos(int xc_handle unsigned long tot_pages, unsigned long *virt_startinfo_addr, unsigned long *virt_load_addr, - dom0_builddomain_t *builddomain, + full_execution_context_t *ctxt, const char *cmdline, unsigned long shared_info_frame, - unsigned int control_evtchn) + unsigned int control_evtchn, + int io_priv) { l1_pgentry_t *vl1tab=NULL, *vl1e=NULL; l2_pgentry_t *vl2tab=NULL, *vl2e=NULL; @@@ -267,9 -263,9 +269,9 @@@ int xc_netbsd_build(int xc_handle if ( setup_guestos(xc_handle, domid, kernel_gfd, tot_pages, &virt_startinfo_addr, - &load_addr, &launch_op.u.builddomain, cmdline, + &load_addr, &st_ctxt, cmdline, op.u.getdomaininfo.shared_info_frame, - control_evtchn) < 0 ) + control_evtchn, io_priv) < 0 ) { ERROR("Error constructing guest OS"); goto error_out; diff --cc xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c index 4e507081be,e6fc3aed05..98eff63453 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c @@@ -62,56 -62,14 +62,63 @@@ static int privcmd_ioctl(struct inode * } break; + case IOCTL_PRIVCMD_MMAP: + { +#define PRIVCMD_MMAP_SZ 32 + privcmd_mmap_t mmapcmd; + privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p; + int i, rc; + + if ( copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)) ) + return -EFAULT; + + p = mmapcmd.entry; + + for (i=0; iPRIVCMD_MMAP_SZ)? + PRIVCMD_MMAP_SZ:(mmapcmd.num-i); + if ( copy_from_user(&msg, p, n*sizeof(privcmd_mmap_entry_t)) ) + return -EFAULT; + + for (j=0;jmm, msg[j].va ); + + if (!vma) + return -EINVAL; + + if (msg[j].va > PAGE_OFFSET) + return -EINVAL; + + if (msg[j].va + (msg[j].npages< vma->vm_end) + return -EINVAL; + + if (rc = direct_remap_area_pages(vma->vm_mm, + msg[j].va&PAGE_MASK, + msg[j].mfn<vm_page_prot, + mmapcmd.dom)) + return rc; + } + } + ret = 0; + } + break; + + case IOCTL_PRIVCMD_INITDOMAIN_EVTCHN: + { + extern int initdom_ctrlif_domcontroller_port; + ret = initdom_ctrlif_domcontroller_port; + } + break; ++ + default: + ret = -EINVAL; + break; } - return ret; } diff --cc xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c index 7b4d1ff0a9,4eeac0c4dd..773a1f83c3 --- a/xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c +++ b/xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c @@@ -56,35 -61,27 +61,33 @@@ static inline int direct_remap_area_pte v += 2; } - address &= ~PMD_MASK; - end = address + size; - if (end > PMD_SIZE) - end = PMD_SIZE; - if (address >= end) - BUG(); do { +#if 0 /* thanks to new ioctl mmaping interface this is no longer a bug */ if (!pte_none(*pte)) { printk("direct_remap_area_pte: page already exists\n"); BUG(); } +#endif v->ptr = virt_to_machine(pte); v->val = (machine_addr & PAGE_MASK) | pgprot_val(prot) | _PAGE_IO; - v++; + if ( ++v == MAX_DIRECTMAP_MMU_QUEUE ) + { + if ( HYPERVISOR_mmu_update(u, MAX_DIRECTMAP_MMU_QUEUE) < 0 ) + return -EFAULT; + goto reset_buffer; + } address += PAGE_SIZE; machine_addr += PAGE_SIZE; pte++; } while (address && (address < end)); - if ( ((v-u) != 0) && (HYPERVISOR_mmu_update(u, v-u) < 0) ) - return -EFAULT; + if ( ((v-u) > 2) && (HYPERVISOR_mmu_update(u, v-u) < 0) ) + { + printk(KERN_WARNING "Failed to ioremap %08lx->%08lx (%08lx)\n", + end-size, end, machine_addr-size); + return -EINVAL; + } - vfree(u); return 0; } @@@ -110,11 -107,10 +113,11 @@@ static inline int direct_remap_area_pmd pte_t * pte = pte_alloc(mm, pmd, address); if (!pte) return -ENOMEM; + - if ( rc = direct_remap_area_pte(pte, address, end - address, - address + machine_addr, prot, domid) ) - return rc; - + error = direct_remap_area_pte(pte, address, end - address, + address + machine_addr, prot, domid); + if ( error ) + break; address = (address + PMD_SIZE) & PMD_MASK; pmd++; } while (address && (address < end)); diff --cc xenolinux-2.4.26-sparse/include/asm-xen/proc_cmd.h index 30cec9aff5,d359b6eaa7..3bf03c6064 --- a/xenolinux-2.4.26-sparse/include/asm-xen/proc_cmd.h +++ b/xenolinux-2.4.26-sparse/include/asm-xen/proc_cmd.h @@@ -13,30 -13,21 +13,42 @@@ typedef struct privcmd_hypercal unsigned long arg[5]; } privcmd_hypercall_t; +typedef struct privcmd_mmap_entry { + unsigned long va; + unsigned long mfn; + unsigned long npages; +} privcmd_mmap_entry_t; + +typedef struct privcmd_mmap { + int num; + domid_t dom; /* target domain */ + privcmd_mmap_entry_t *entry; +} privcmd_mmap_t; + +typedef struct privcmd_blkmsg +{ + unsigned long op; + void *buf; + int buf_size; +} privcmd_blkmsg_t; + - #define IOCTL_PRIVCMD_HYPERCALL \ + /* + * @cmd: IOCTL_PRIVCMD_HYPERCALL + * @arg: &privcmd_hypercall_t + * Return: Value returned from execution of the specified hypercall. + */ + #define IOCTL_PRIVCMD_HYPERCALL \ _IOC(_IOC_NONE, 'P', 0, sizeof(privcmd_hypercall_t)) - #define IOCTL_PRIVCMD_BLKMSG \ - _IOC(_IOC_NONE, 'P', 1, sizeof(privcmd_blkmsg_t)) + + /* + * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN + * @arg: n/a + * Return: Port associated with domain-controller end of control event channel + * for the initial domain. + */ + #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \ + _IOC(_IOC_NONE, 'P', 1, 0) +#define IOCTL_PRIVCMD_MMAP \ + _IOC(_IOC_NONE, 'P', 2, sizeof(privcmd_mmap_t)) #endif /* __PROC_CMD_H__ */